package com.irs.controller;

import com.irs.pojo.BuildingInfo;
import com.irs.service.BuildingInfoService;
import com.irs.util.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class BuildController {

    @Autowired
    BuildingInfoService buildingInfoService;

    /**
     * 跳转到列表页面
     * @return
     */
    @GetMapping("/build/golist")//数据库中的href地址
    public String golist() {
        //跳转到build下的buildList界面
        return "page/build/buildList";
    }

    //查
    @GetMapping("/build/list")
    @ResponseBody
    public Object buildList() {
        List<BuildingInfo> buildingInfoList = buildingInfoService.select(new BuildingInfo());
        //返回JSON
        return  ResultUtil.ok(buildingInfoList, buildingInfoList.size());
    }




}
